#include "slic.h"
#include "extractorVolumneVector.h"

extractorVolumneVector::extractorVolumneVector(char* _labelImage, Slic _clustering){
	this->labelImage = _labelImage;
	this->size = _clustering.getCenter_counts().size();

	double _threshold = 1.25;
	int _sizeVolVec = 2;
	double _avg = _clustering.getAverageSuperpixel();

	for(int i = 0; i < size; i++){
		volumneVector _volVec(2,i,_labelImage);
		int vol = _clustering.getVolumneSuperpixel(i);
		_volVec.setVolumne(vol);

		double _ratio = (double)vol / (double)_avg;
		if(_ratio >= _threshold){
			vector<uchar> _v;
			_v.push_back(1);
			_v.push_back(1);
			_volVec.addValue(_v);
		}
		else{
			vector<uchar> _v;
			_v.push_back(0);
			_v.push_back(0);
			_volVec.addValue(_v);
		}

		this->listVector.push_back(_volVec);
	}

}

vector<volumneVector> extractorVolumneVector::getListVector() {
	return this->listVector;
}